package com.tool.grab.vpn;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class NetSession {
    private DateFormat format;

    private int type;
    private int localIP;
    private int localPort;
    private int remoteIP;
    private int remotePort;
    private int packetCount;
    private int sendBytes;
    private boolean isHttp;
    private String host;
    private String url;
    private long modificationTime;
    private String modificationDate;

    public NetSession(){
        format = new SimpleDateFormat("yyyy:MM:dd_HH:mm:ss:s",Locale.getDefault());
    }


    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getLocalIP() {
        return localIP;
    }

    public void setLocalIP(int localIP) {
        this.localIP = localIP;
    }

    public int getLocalPort() {
        return localPort;
    }

    public void setLocalPort(int localPort) {
        this.localPort = localPort;
    }

    public int getRemoteIP() {
        return remoteIP;
    }

    public void setRemoteIP(int remoteIP) {
        this.remoteIP = remoteIP;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getRemotePort() {
        return remotePort;
    }

    public void setRemotePort(int remotePort) {
        this.remotePort = remotePort;
    }

    public boolean isHttp() {
        return isHttp;
    }

    public void setHttp(boolean http) {
        isHttp = http;
    }

    public long getModificationTime() {
        return modificationTime;
    }


    public String getModificationDate() {
        return modificationDate;
    }

    public void increase(){
        packetCount ++;
    }

    public int getPacketCount(){
        return packetCount;
    }

    public int getSendBytes() {
        return sendBytes;
    }

    public void setSendBytes(int sendBytes) {
        this.sendBytes = sendBytes;
    }

    public void refreshTime(){
        modificationTime = System.currentTimeMillis();
        modificationDate = format.format(new Date(modificationTime));
    }


}
